/**
 * Project Name:pums-ui
 * File Name:index.js
 * Package Name:release
 * Description: 审批发布相关
 * Date:2019/5/29 10:37
 * Copyright (c) 2019, yxw@bostech.com.cn All Rights Reserved.
 */

export const materialDataList = {
  allMaterialData: [
    {
      name: '编制说明',
      shape: '电子文件',
      requirement: '',
      necessity: '必要',
      remarks: '',
      hasUpload: true,
      upload: 'bzsmUpload'
    }, {
      name: '规划文本',
      shape: '电子文件',
      requirement: '',
      necessity: '必要',
      remarks: '',
      hasUpload: true
    }, {
      name: '衔接意见',
      shape: '电子文件',
      requirement: '',
      necessity: '必要',
      remarks: '',
      hasUpload: true
    }, {
      name: '专家评审意见',
      shape: '电子文件',
      requirement: '',
      necessity: '必要',
      remarks: '',
      hasUpload: true
    }, {
      name: '其他附件',
      shape: '电子文件',
      requirement: '',
      necessity: '必要',
      remarks: '',
      hasUpload: true
    }
  ],
  // 专项规划-备案
  zxBaMaterialData: [
    {
      name: '编制说明',
      shape: '电子文件',
      requirement: '',
      necessity: '非必要',
      remarks: '',
      hasUpload: true,
      upload: 'bzsmUpload'
    }, {
      name: '规划文本',
      shape: '电子文件',
      requirement: '',
      necessity: '必要',
      remarks: '',
      hasUpload: true
    }, {
      name: '衔接意见',
      shape: '电子文件',
      requirement: '',
      necessity: '非必要',
      remarks: '',
      hasUpload: true
    }, {
      name: '专家评审意见',
      shape: '电子文件',
      requirement: '',
      necessity: '非必要',
      remarks: '',
      hasUpload: true
    }, {
      name: '其他附件',
      shape: '电子文件',
      requirement: '',
      necessity: '非必要',
      remarks: '',
      hasUpload: true
    }
  ],
  // 专项规划-一般
  zxYbMaterialData: [
    {
      name: '编制说明',
      shape: '电子文件',
      requirement: '',
      necessity: '必要',
      remarks: '',
      hasUpload: true,
      upload: 'bzsmUpload'
    }, {
      name: '规划文本',
      shape: '电子文件',
      requirement: '',
      necessity: '必要',
      remarks: '',
      hasUpload: true
    }, {
      name: '衔接意见',
      shape: '电子文件',
      requirement: '',
      necessity: '非必要',
      remarks: '',
      hasUpload: true
    }, {
      name: '专家评审意见',
      shape: '电子文件',
      requirement: '',
      necessity: '非必要',
      remarks: '',
      hasUpload: true
    }, {
      name: '其他附件',
      shape: '电子文件',
      requirement: '',
      necessity: '必要',
      remarks: '',
      hasUpload: true
    }
  ],
  // 除备案外的其他规划
  otherMaterialData: [
    {
      name: '编制说明',
      shape: '电子文件',
      requirement: '',
      necessity: '必要',
      remarks: '',
      hasUpload: true,
      upload: 'bzsmUpload'
    }, {
      name: '规划文本',
      shape: '电子文件',
      requirement: '',
      necessity: '必要',
      remarks: '',
      hasUpload: true
    }, {
      name: '衔接意见',
      shape: '电子文件',
      requirement: '',
      necessity: '必要',
      remarks: '',
      hasUpload: true
    }, {
      name: '专家评审意见',
      shape: '电子文件',
      requirement: '',
      necessity: '必要',
      remarks: '',
      hasUpload: true
    }, {
      name: '其他附件',
      shape: '电子文件',
      requirement: '',
      necessity: '非必要',
      remarks: '',
      hasUpload: true
    }
  ]
};
/**
 * 通用版附件上传
 * @param name
 * @returns {{sucMethod: sucMethod, failMethod: failMethod}}
 */
export const fileUploadMaps = function (name, sucessCallback, failCallback) {
  let fileMap = {
    sucMethod: function (res, params, self) {
      if (self.fileTypeIds[name] instanceof Array) {
        self.fileTypeIds[name].push(Object.assign({ id: res.data.data, name: params.file.name }, params.file))
      } else {
        self.fileTypeIds[name] = [];
        self.fileTypeIds[name].push(Object.assign({ id: res.data.data, name: params.file.name }, params.file))
      }
      if (typeof sucessCallback === 'function') {
        sucessCallback()
      }
      self.successNotify()
    },
    failMethod: function (res, params, self) {
      if (typeof failCallback === 'function') {
        failCallback()
      }
      self.failNotify()
    }
  };
  return fileMap;
};
// 不同规划类型，规划等级流程
export const stepMap = {
  // 发展规划
  'A': [
    {
      title: '提交',
      icon: 'el-icon-upload'
    }, {
      title: '审核',
      icon: 'el-icon-edit'
    }, {
      title: '审批',
      icon: 'el-icon-picture'
    }, {
      title: '印发',
      icon: 'el-icon-star-on'
    }
  ],
  // 专项规划
  'B': {
    //重点
    'A': [
      {
        title: '提交',
        icon: 'el-icon-upload'
      }, {
        title: '审核',
        icon: 'el-icon-picture'
      }, {
        title: '审批',
        icon: 'el-icon-edit',
        class: 'transform-deg'
      }, {
        title: '',
        icon: 'el-icon-edit',
        class: 'transform-deg_line'
      }, {
        title: '联合印发',
        icon: 'el-icon-star-on',
        class: 'transform-deg-up'
      }, {
        title: '政府印发',
        icon: 'el-icon-star-on',
        class: 'transform-deg-down line-diplay'
      }, {
        title: '政府',
        icon: 'el-icon-star-on',
        class: 'margin-class line-diplay text-display'
      }, {
        title: '政府',
        icon: 'el-icon-star-on',
        class: 'margin-class line-diplay text-display'
      }
    ],
    // 一般
    'B': [
      {
        title: '提交',
        icon: 'el-icon-upload'
      }, {
        title: '审批',
        icon: 'el-icon-picture'
      }, {
        title: '印发',
        icon: 'el-icon-star-on'
      }
    ],
    // 报备
    'C': [
      {
        title: '备案',
        icon: 'el-icon-upload'
      }, {
        title: '发布',
        icon: 'el-icon-picture'
      }
    ]
  },
  //区域规划
  'C': [
    {
      title: '提交',
      icon: 'el-icon-upload'
    }, {
      title: '审核',
      icon: 'el-icon-picture'
    }, {
      title: '审批',
      icon: 'el-icon-edit'
    }, {
      title: '印发',
      icon: 'el-icon-star-on'
    }
  ],
  // 空间规划
  'D': [

  ]
};
/**
 * 根据规划类型和规划等级获取步骤
 * @param category 规划类型
 * @param planningRank 规划等级
 * @param stepMap 规划步骤
 * @returns {Array}
 */
export const getStepList = function (category, planningRank, stepMap) {
  let stepList = [];
  // 发展规划
  switch (category) {
    // 发展规划
    case 'A':
      stepList = stepMap['A'];
      break;
    // 专项规划
    case 'B':
      stepList = stepMap['B'][planningRank];
      break;
    // 区域规划
    case 'C':
      stepList = stepMap['C'];
      break;
    // 区域规划
    case 'D':
      break
  }
  return stepList;
};

// 不同环节调用不同的方法
export const stateUrlMap = {
  // 部门初审
  '2': {
    transact: function (self) {
      self.deptFirst()
    }
  },
  // 本级政府审议
  '3': {
    transact: function (self) {
      self.gov()
    }
  },
  // 省级人大审议
  '4': {
    transact: function (self) {
      self.conpress()
    }
  },
  // 市级政府审议
  '5': {
    transact: function (self) {
      self.cityGov()
    }
  },
  // 市级人大审议
  '6': {
    transact: function (self) {
      self.cityConpress()
    }
  },
  // 省级政府审议
  '7': {
    transact: function (self) {
      self.provinceGov()
    }
  },
  // 省级人大审议
  '8': {
    transact: function (self) {
      self.provinceCongress()
    }
  }
};
